export const parseDebugConfig = <T extends DebugConfig>(value: T): T => {
  const obj: DebugConfig = {
    debug: value.debug
  }

  if (!obj.debug) return obj as T

  Object.keys(value).forEach((key) => {
    if (key !== 'debug' && typeof value[key] !== 'undefined') {
      obj[key] = value[key]
    }
  })

  return obj as T
}

type DebugConfig = {
  debug: boolean
  [key: string]: boolean | string | undefined
}
